package com.yswy.domain.entity.tf;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yswy.common.enums.TfPlatformEnums;
import com.yswy.common.enums.base.TypeEnum;
import com.yswy.domain.common.BasePojo;
import com.yswy.domain.entity.user.User;
import com.yswy.domain.vo.gld.addOrUpate.TgDeductionAddOrUpdate;
import com.yswy.domain.vo.gld.addOrUpate.TgEventAddOrUpdate;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;

import java.util.List;

@Data
@Builder
@AllArgsConstructor
@Api(tags = "事件配置")
@TableName(value = "tg_event")
public class TgEvent extends BasePojo<TgEvent> {
    @ApiModelProperty("备注")
    private String remarks;
    @ApiModelProperty("编号")
    private String identifier;
    @ApiModelProperty("投放（上架）平台  0 巨量  1 快手 ")
    private String tfPlatform;
    @TableField(exist = false)
    private List<TgEventChild> tgEventChildrens;


    public TgEvent(TgEventAddOrUpdate res, User user){
        this.remarks =res.getRemarks();
        this.identifier =res.getIdentifier();
        TypeEnum tfPlatformEnumsEnum = TypeEnum.messageOf(TfPlatformEnums.class , res.getTfPlatform());
        this.tfPlatform =tfPlatformEnumsEnum.toString();
        super.setCreateBy(user.getId().longValue());
    }
    public TgEvent(){

    }
}
